import { WeaTableEditable, WeaLocaleProvider, WeaSelect } from 'ecCom';
import { observer } from 'mobx-react';
import { Button } from 'antd';
import * as React from 'react';
import Dialog from '.';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class AddSelectOptionsDialog extends React.Component {
    render() {
        const { store } = this.props;
        
        store.setTitle(getLabel('502870', '选项维护'));
        // store.setbutton();
        return (
            <Dialog ecId={`${this && this.props && this.props.ecId || ''}_Dialog@msdov6`} dialog={store}>
                
                <WeaTableEditable ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEditable@pd49ja`}
                    draggable={true}
                    title={<span style={{ marginLeft: "10px", width: 150 }}>{getLabel('511875','关联子字段')} :<WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@2vopkj`}
                        options={store.relatedChildGroup}
                            style ={{width:100, marginLeft:20}}
                            value={store.relatedChild}
                        // viewAttr={viewAttr}
                        onChange={store.childChange}
                    /></span>}
                    showCopy={false}
                    columns={[{
                      com: [
                          { type: 'input' , viewAttr: 3, key: 'selectName' }
                      ],
                      dataIndex: 'selectName',
                      title: getLabel('502867', '可选项文字'),
                      width: '35%',
                  }, {
                      com: [
                          { type: 'checkbox', viewAttr: 2, key: 'isdefault' }
                      ],
                      dataIndex: 'isdefault',
                      title: getLabel('502868','默认'),
                      width: '8%',
                  }, {
                    com: [
                        { type: 'select', key: 'childValue', multiple: (store.selectValue || []).length > 0, options: store.selectValue || [], style:{width: 220}}
                    ],
                    dataIndex: 'childValue',
                    title: getLabel('511876','子字段选项'),
                    width: '35%',
                }, {
                    com: [
                        { type: 'checkbox', viewAttr: 2, key: 'cancle'}
                    ],
                    dataIndex: 'cancle',
                    title: getLabel('502869','封存'),
                    width: '8%',
                }]}
                    datas={store.datas.slice()}
                    onChange={store.onChange}
                    tableProps={{
                        scroll: { y: 200}
                    }}
                    rowKey="randomkey"
                />
            </Dialog>
        )
    }
}